package org.finalministry.database.dao;

import java.util.List;

import org.finalministry.objects.Preacher;

public class PreacherDAO extends AbstractDAO {

	private static final String TABLENAME = "preacher";

	public PreacherDAO() {
		super();
	}

	/**
	 * Insert a new Preacher into the database.
	 * 
	 * @param Preacher
	 * @return persisted ID
	 * @throws DataAccessLayerException
	 */
	public Preacher merge(Preacher preacher) throws DataAccessLayerException {

		return (Preacher) super.merge(preacher);
	}

	/**
	 * Delete a detached Preacher from the database.
	 * 
	 * @param Preacher
	 */
	public void delete(Preacher preacher) throws DataAccessLayerException {

		super.delete(preacher);
	}

	/**
	 * Find an Preacher by its primary key.
	 * 
	 * @param id
	 * @return
	 */
	public Preacher find(Long id) throws DataAccessLayerException {

		return (Preacher) super.find(Preacher.class, id);
	}

	/**
	 * Finds all Preachers in the database.
	 * 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<Preacher> findAll() throws DataAccessLayerException {

		return super.findAll(Preacher.class);
	}

	/**
	 * Get table name
	 */
	@Override
	protected String getTableName() {

		return TABLENAME;
	}
}
